package springboard.webapp;

import common.mybatis.EnableMybatis;
import common.shiro.EnableShiro;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.oas.annotations.EnableOpenApi;

/**
 * @Author wangyue
 * @Version 3.0
 * @Date 2025-02-13
 */

@Slf4j
@SpringBootApplication(scanBasePackages = {"springboard"})
@EnableMybatis(basePackages = {"springboard"})
@EnableShiro
@EnableCaching
@EnableScheduling
@EnableOpenApi
public class Main {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(Main.class, args);
        Environment env = application.getEnvironment();
        String address = env.getProperty("server.address", "localhost");
        String port = env.getProperty("server.port");
        String contextPath = env.getProperty("server.servlet.context-path", "");
        log.info("\n----------------------------------------------------------\n\t" +
                "启动成功:\n\t" +
                "访问网址: \thttp://" + address + ":" + port + contextPath + "\n\t" +
                "Swagger: \thttp://" + address + ":" + port + contextPath + "/swagger-ui/\n\t" +
                "----------------------------------------------------------");
    }

}
